package com.example.dem12;/**
* @program: xian-cheng
*
* @description:
*
* @author: 诸葛龙辰
*
* @create: 2022-11-01 21:06
**/
public class Pig extends Thread{
    @Override
    public void run() {
        synchronized (LockSuo.lock2){
            System.out.println(Thread.currentThread().getName()+"吃猪食");
            synchronized (LockSuo.lock1){
                System.out.println(Thread.currentThread().getName()+"吃狗食");
                System.out.println(Thread.currentThread().getName()+"可以吃饭了");
            }
        }
    }

}
